<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var num = [1,2,23,-3,15,99,888,33,77];
    function min(num) {
        var getMin = num[0];//假设第一个数是最小的即为minnum
        for (let i = 0; i <= num.length; i++) {
            if (num[i] < getMin) {
                getMin = num[i];
            }//判断是否有比minnum小的数，如果有，则将这个数赋值给minnum
        }
        return getMin;//循环直到输出最小值
    }
    document.write(min(num)); //输出结果
</script>

</html>